package com.order_system.controller;


import com.order_system.entity.Customer;
import com.order_system.entity.ResModel;
import com.order_system.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 李阳
 * @since 2023-01-06
 */
@RestController
@RequestMapping("/api/customer")
public class CustomerController {

    @Autowired
    private CustomerService customerService;

    /**
     * 登录
     * @param customer 客户实体
     * @return
     */
    @PostMapping(value = "/login",produces = "application/json")
    public ResModel login(@RequestBody Customer customer){
        return customerService.login(customer);
    }

    /**
     * 注册
     * @param customer 客户实体
     * @return
     */
    @PostMapping(value = "/register",produces = "application/json")
    public ResModel register(@RequestBody Customer customer){
        return customerService.register(customer);
    }
}

